Arrays Methods
Setup
- Navigate to the
student_examplesfolder for today. - Create a file called
array_methods.jsto use for practice code. - Open it in your text editor. Add a
console logand run your code to confirm that you can see the output in your terminal.
Lesson Objectives
- Use array methods and research more methods on their own
ARRAY METHODS: Adding and Removing Elements
Activity
In this lesson we're going to learn how manipulate our arrays. We'll learn how to add items, remove items, do a simple sort and more!
- Let's make an array together called
favMoviesand put everyone's favorite movie in there - We'll share the array in slack and break off into small groups for about
10minutes and each group will research and give us an explanation and a code example of the following methods
Methods - each group gets one
- indexOf
- push
- pop
- reverse
- unshift
- shift
- slice
- splice
- sort